package com.eam.core.core.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统日志表
 * </p>
 *
 * @author huangjj
 * @since 2022-01-06
 */
@TableName("t_log")
@ApiModel(value = "Log对象", description = "系统日志表")
public class Log implements Serializable {

    private static final long serialVersionUID = 1L;


    @ApiModelProperty("ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("日志名称")
    private String logName;

    @ApiModelProperty("日志类型")
    private String logType;

    @ApiModelProperty("日志信息")
    private String logMessage;

    @ApiModelProperty("操作人")
    private String operator;

    @ApiModelProperty("生成时间")
    private LocalDateTime logDate;

    public Log() {
    }

    public Log(String logName, String logType, String logMessage, String operator) {
        this.logName = logName;
        this.logType = logType;
        this.logMessage = logMessage;
        this.operator = operator;
        this.logDate = LocalDateTime.now();
    }

    public static Log systemLog(String logName, String logMessage){
        return new Log(logName,"SYSTEM",logMessage,"SYSTEM");
    }

    public static Log userLog(String logName, String logMessage,String user){
        return new Log(logName,"USER",logMessage,user);
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLogName() {
        return logName;
    }

    public void setLogName(String logName) {
        this.logName = logName;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public String getLogType() {
        return logType;
    }

    public void setLogType(String logType) {
        this.logType = logType;
    }

    public String getLogMessage() {
        return logMessage;
    }

    public void setLogMessage(String logMessage) {
        this.logMessage = logMessage;
    }

    public LocalDateTime getLogDate() {
        return logDate;
    }

    public void setLogDate(LocalDateTime logDate) {
        this.logDate = logDate;
    }

    @Override
    public String toString() {
        return "Log{" +
        "id=" + id +
        ", logName=" + logName +
        ", logType=" + logType +
        ", logMessage=" + logMessage +
        ", logDate=" + logDate +
        "}";
    }
}
